/* -----------------------------------------------------------------------
 * test SupplyCount
 * -----------------------------------------------------------------------
 */

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

int main() {
// based off of testUpdateCoins  example provided for class
    //int i;
    int seed = 1000;
    int numPlayer = 2;

	int r;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;

	int test;
	int failed = 0;

	
	memset(&G, 23, sizeof(struct gameState));   // clear the game state
	r = initializeGame(numPlayer, k, seed, &G); // initialize a new game
	
	
	//check supply -1 for non used card
	test = -1;
	if(test != supplyCount(minion, &G) ){
		failed = 1;
		printf("Unittest 4 fail: supplyCount\n");
	}
	
	//check supply correct for feast
	test = 10;
	if(test != supplyCount(feast, &G) ){
		failed = 1;
		printf("Unittest 4 fail: supplyCount\n");
	}

	//check value updates
	//check supply correct for feast
	G.supplyCount[feast] = 5;
	test = 5;
	if(test != supplyCount(feast, &G) ){
		failed = 1;
		printf("Unittest 4 fail: supplyCount\n");
	}
	
	//check value updates
	//check supply correct for feast
	G.supplyCount[feast] = 0;
	test = 0;
	if(test != supplyCount(feast, &G) ){
		failed = 1;
		printf("Unittest 4 fail: supplyCount\n");
	}
	
	
	if(failed == 0){
		printf("unittest4: supplyCount - All tests passed!\n");
	}
    return 0;
}